﻿using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SObject.Test
{
    [TestFixture]
    class Object_NameUtility
    {
        [Test]
        [TestCase("MyObjectName", "MyObjectName.object.xml")]
        [TestCase("anotherName", "anotherName.object.xml")]
        [TestCase("123Name", "123Name.object.xml")]
        public void GetFilename(string Name, string Filename)
        {
            string filename = SObject.Object.NameUtility.GetFilename(Name);
            Assert.AreEqual(Filename, filename);
        }

        [Test]
        [TestCase("MyObjectName.object.xml", "MyObjectName")]
        [TestCase("anotherName.object.xml", "anotherName")]
        [TestCase("123Name.object.xml", "123Name")]
        [TestCase("NameWith.Dot.object.xml", "NameWith.Dot")]
        [TestCase("NameWith:Colon:object.xml", "NameWith:Colon", ExpectedException = typeof(SObject.Exception))]
        public void GetName(string Filename, string Name)
        {
            string name = SObject.Object.NameUtility.GetName(Filename);
            Assert.AreEqual(Name, name);
        }
    }
}
